import request from '@/utils/request'
import { Pagination } from '@/types/global';

// 参数数据
export interface NoticeData {
  id?: number;
  title?: string;
  content: string;
  type?: number | string;
  status?: number;
}

// 查询参数
export interface NoticeParams extends Partial<NoticeData> {
  current?: number;
  size?: number;
  startDate?: string;
  endDate?: string;
}

// 通知列表
export function pageNotice(params: NoticeParams) {
  return request<Pagination<NoticeData[]>>('get', '/notice/page', { params })
}

// 通知详情
export function getNotice(id: any) {
  return request<NoticeData>('get', '/notice/' + id)
}

// 新增通知
export function saveNotice(data: NoticeData) {
  return request('post', '/notice', data)
}

// 修改通知
export function updateNotice(data: NoticeData) {
  return request('put', '/notice', data)
}

// 删除通知
export function deleteNotice(ids: any) {
  return request('delete', '/notice/' + ids)
}
